Skip to content

Fix TimedPublishSubscriber for doctrine/dbal 4.x#3750

Merged
bobvandevijver merged 12 commits into
bolt:6.1from
Senne:fix/timed-publish-subscriber-dbal4
Jul 20, 2026
Merged

Fix TimedPublishSubscriber for doctrine/dbal 4.x#3750
bobvandevijver merged 12 commits into
bolt:6.1from
Senne:fix/timed-publish-subscriber-dbal4

Conversation

@Senne

@Senne Senne commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
  • Replace removed Connection::executeUpdate() with executeStatement()
  • Use plain (non colon-prefixed) named parameters as required by DBAL 4
  • Pass an explicit Types::DATETIME_MUTABLE type for the bound Carbon/DateTime value
  • Log caught exceptions at debug level instead of swallowing them silently

Fixes #3748

Copilot AI review requested due to automatic review settings July 6, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates TimedPublishSubscriber to work correctly with doctrine/dbal 4.x by using the supported DBAL APIs and correct parameter binding, and improves diagnostics by logging previously swallowed exceptions.

Changes:

  • Replace removed Connection::executeUpdate() calls with executeStatement().
  • Fix DBAL 4 named-parameter binding (no colon-prefixed keys) and bind Carbon with Types::DATETIME_MUTABLE.
  • Add debug-level logging when the subscriber catches an exception.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Event/Subscriber/TimedPublishSubscriber.php Outdated
Comment thread src/Event/Subscriber/TimedPublishSubscriber.php
Comment thread phpstan-baseline.php Outdated
Comment thread phpstan-baseline.php Outdated

@bobvandevijver bobvandevijver left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, lets use the logger trait instead

Comment thread src/Event/Subscriber/TimedPublishSubscriber.php
Comment thread src/Event/Subscriber/TimedPublishSubscriber.php Outdated
Comment thread src/Event/Subscriber/TimedPublishSubscriber.php Outdated
Senne and others added 12 commits July 20, 2026 16:09
- Replace removed Connection::executeUpdate() with executeStatement()
- Use plain (non colon-prefixed) named parameters as required by DBAL 4
- Pass an explicit Types::DATETIME_MUTABLE type for the bound Carbon/DateTime value
- Log caught exceptions at debug level instead of swallowing them silently

Fixes bolt#3748
Typing $defaultConnection as the generic 'object' (as returned by
ManagerRegistry::getConnection()) hid the executeStatement() method from
PHPStan. Narrow it to Doctrine\DBAL\Connection instead, and drop the
now-obsolete baseline entry for the old executeUpdate() call.
Matches CI's ClassPropertyAssignToConstructorPromotionRector suggestion.
Clarify that the failure is silent for the user, but logged at debug level for diagnostics.
Co-authored-by: Bob van de Vijver <bobvandevijver@users.noreply.github.com>
@bobvandevijver
bobvandevijver force-pushed the fix/timed-publish-subscriber-dbal4 branch from ba60a56 to a85b839 Compare July 20, 2026 14:15
@bobvandevijver
bobvandevijver enabled auto-merge (squash) July 20, 2026 14:18
@bobvandevijver
bobvandevijver disabled auto-merge July 20, 2026 14:19
@bobvandevijver
bobvandevijver merged commit 59829a3 into bolt:6.1 Jul 20, 2026
34 of 35 checks passed
@bobvandevijver

Copy link
Copy Markdown
Member

Thank you @Senne!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimedPublishSubscriber silently fails to publish/depublish content on doctrine/dbal 4.x

3 participants